package com.zhangjh.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zhangjh.exception.UserNotExistException;

@ControllerAdvice
public class ControllerExceptionHandler {
	
	@ExceptionHandler(UserNotExistException.class)
	@ResponseBody
	public Map<String,Object> handleUserNotException(UserNotExistException ue){
		Map<String,Object> relust = new HashMap<>();
		relust.put("id", ue.getId());
		relust.put("message", ue.getMessage());
		return relust;
	}
}
